-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added comparison function as histogram operation (with colorized + info based string return) #763
base: develop
Are you sure you want to change the base?
Conversation
gohil-jay
commented
Jul 1, 2022
if (list(self.axes)==list(hist2.axes)): | ||
return "" | ||
else: | ||
return "The axes [" + "\033[91m" + str(list(self.axes)) + " and " + str(list(hist2.axes)) + "\033[0m" + "] are not equal." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return "The axes [" + "\033[91m" + str(list(self.axes)) + " and " + str(list(hist2.axes)) + "\033[0m" + "] are not equal." | |
return f"The axes [\033[91m{list(self.axes)} and {list(hist2.axes)}\033[0m] are not equal." |
F-strings were made for this. :) Also I'd pull out the color formatting into a variable, like red
and reset
. Actually, there are lots of concerns with color formatting (needs to be disablable and such), at least rich can auto-format this, so probably leave the color formatting off for the moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I bet if you do import rich; rich.print(h.compare(h2))
this would still be colorful. ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I was going to do something similar (with termcolor), but then though I'd do it without importing a library..
@henryiii, pre-commit throws few errors... Any feedback/suggestion? |
It's complaining because you are using the result of re.search without checking to see if it has a result first. I think the best fix, though, is to use |
I've been looking for something like |
Redefined storage check & removed variance check (as variances is based on values that are already checked)
Seems alright now (?) |
Note: the goal is to support |